<template>
  <div class="container">
    <div @click="changeLan(index)" style="flex:1" v-for="(item,index) in list" :key="index">
      <span :class="currentIndex === index ? 'active' :'' ">{{item}}</span>
    </div>
  </div>
</template>

<script>
  export default {
    name: "languageChange",
    data() {
      return {
        list: ['English', '简体中文'],
        //为0是英文
        currentIndex: 0
      }
    },
    methods: {
      changeLan(index) {
        this.currentIndex = index;
        this.$emit('change',index)
      }
    }
  }
</script>

<style scoped>
  .container {
    display: flex;
    white-space: nowrap;
    text-align: center;
    float: right;
    margin: 10px;
    font-size: 14px;
  }

  .container span {
    margin: 5px;
  }

  .active {
    color: #00a16c;
    border-bottom: 3px solid #00a16c;
    padding: 5px;
    font-size: 16px;
  }
</style>

